package cars

import (
	"time"

	"gorm.io/gorm"
)

type CarsDeductMoneyStruct struct {
	Id         int       `gorm:"type:int(11) auto_increment; NOT NULL; primary_key"`
	ParkCode   string    `gorm:"type:varchar(255); COMMENT:'车场编号'"`
	ParkName   string    `gorm:"type:varchar(255); COMMENT:'车场名称'"`
	CarNumber  string    `gorm:"type:varchar(255); COMMENT:'车牌号'"`
	CarType    int       `gorm:"type:int(11); COMMENT:'车型 1: 小型车2: 中型车3: 大型车4: 其他'"`
	CarNoColor int       `gorm:"type:int(11); COMMENT:'车牌颜色 1-蓝牌 3-黄牌 6-绿牌 7-白牌 8-黑牌'"`
	TransAmt   int       `gorm:"type:int(11); NOT NULL; COMMENT:'扣费金额，单位：分'"`
	TransType  int       `gorm:"type:int(11); COMMENT:'交易方式，1-同步返回扣费结果，2-异步返回扣费结构哦（通过支付结果通知接口推送支付结果）'"`
	Status     int       `gorm:"type:tinyint(1);  COMMENT:'状态'"`
	StaticNo   string    `gorm:"type:varchar(255); COMMENT:'静态单号'"`
	OrderNo    string    `gorm:"type:varchar(255); COMMENT:'订单号'"`
	OrderType  int       `gorm:"type:tinyint(1); COMMENT:'订单状态'"`
	CreatedAt  time.Time `gorm:"type:datetime; COMMENT:'创建时间'"`
	UpdatedAt  time.Time `gorm:"type:datetime; COMMENT:'更新时间'"`
	MuchId     string    `gorm:"type:varchar(255); COMMENT:'商户id'"`
	PushStatus int       `gorm:"type:tinyint(1); COMMENT:'推送状态'"`
	PushErrNum int       `gorm:"type:tinyint(1); COMMENT:'失败次数'"`
	PushTime   int       `gorm:"type:tinyint(1); COMMENT:'下次推送时间'"`
}

func (c *CarsDeductMoneyStruct) TableName() string {
	return "cars_deduct_money"
}
func (c *CarsDeductMoneyStruct) Create(db *gorm.DB, data map[string]interface{}) error {

	return db.Table(c.TableName()).Create(&data).Error
}
